/**
 * Created by zhuo on 2017/8/1.
 */
var express = require('express');
var router = express.Router();
// import mockCompanyData from './mockData/companysMock.json';
var authority = require('./mockData/mokeAuthority.json');
var result = require("./mockData/operationResult.json");

var createAndUpdateData = {
    "authority": {
        "createTime": 9999999,
        "icon": "测试内容yh62",
        "level": 11620,
        "name": "权限",
        "id": "权限",
        "parentName": "测试内容g8b8",
        "remark": "测试内容gqc7",
        "style": "测试内容4f3l",
        "type": "测试内容1050",
        "url": "测试内容pp6y",
        "valid": true
    },
    "message": "测试内容cs06",
    "result": true
}

/* GET users listing. */
router.get('/getAuthorityList', function (req, res, next) {
    console.info("get authorities now...");
    res.json(authority);
});

router.post('/create', function (req, res, next) {
    console.info("create authorities now...");
    res.json(createAndUpdateData);
});
router.post('/delete', function (req, res, next) {
    console.info("delete authorities now..." + JSON.stringify(req.body));
    res.json(result);
});
router.post('/update', function (req, res, next) {
    console.info("update authorities now...");
    res.json(createAndUpdateData);
});

/**
 * ACS项目 2017/10/22
 */
router.get('/list', function (req, res, next) {
    res.json({
        "message": "测试内容a78f",
        "result": 1,
        "resultData": [
            {
                id: 0,
                "name": "系统管理",
                "parentName": "",
                "desc": "系统管理",
                "status": "1",
                "url": "system",
                parentName: '',
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 1,
                "name": "社区管理",
                "parentName": "",
                "desc": "社区管理",
                "status": "1",
                "url": "community",
                parentName: '',
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 2,
                "name": "用户管理",
                "parentName": "系统管理",
                "desc": "管理系统使用者",
                "status": "1",
                "url": "system/user",
                parentName: '0',
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 3,
                "name": "添加用户",
                "parentName": "用户管理",
                "desc": "添加管理系统使用者",
                "status": "1",
                parentName: '2',
                "url": "system/user/create",
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 4,
                "name": "查询修改用户",
                "parentName": "用户管理",
                "desc": "查询修改管理系统使用者",
                "status": "1",
                parentName: '2',
                "url": "system/user/modify",
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 5,
                "name": "删除用户",
                "parentName": "用户管理",
                "desc": "删除管理系统使用者",
                "status": "1",
                parentName: '2',
                "url": "system/user/delete",
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 6,
                "name": "角色管理",
                "parentName": "系统管理",
                "desc": "管理系统角色",
                "status": "1",
                parentName: '0',
                "url": "system/role",
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {
                id: 7,
                "name": "添加角色",
                "parentName": "角色管理",
                "desc": "添加系统角色",
                "status": "1",
                parentName: '6',
                "url": "system/role/create",
                remark: 'remark',
                updateTime: 1500192793000,
            },
            {

                id: 8,
                "name": "查询修改角色",
                "parentName": "角色管理",
                "desc": "查询修改系统角色",
                "status": "1",
                parentName: '6',
                "url": "system/role/modify",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 9,
                "name": "删除角色",
                "parentName": "角色管理",
                "desc": "删除系统角色",
                "status": "0",
                parentName: '6',
                "url": "system/role/delete",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 10,
                "name": "住户管理",
                "parentName": "社区管理",
                "desc": "管理住户",
                "status": "1",
                parentName: '1',
                "url": "community/resident",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 11,
                "name": "修改住户",
                "parentName": "住户管理",
                "desc": "修改住户信息",
                "status": "1",
                parentName: '10',
                "url": "community/resident/modify",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 12,
                "name": "增加住户",
                "parentName": "住户管理",
                "desc": "增加住户",
                "status": "1",
                parentName: '10',
                "url": "community/resident/create",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 13,
                "name": "删除住户",
                "parentName": "住户管理",
                "desc": "删除住户",
                "status": "1",
                parentName: '10',
                "url": "community/resident/delete",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 14,
                "name": "删除住户",
                "parentName": "住户管理",
                "desc": "删除住户",
                "status": "1",
                parentName: '10',
                "url": "community/resident/delete",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 15,
                "name": "楼宇管理",
                "parentName": "社区管理",
                "desc": "管理社区楼宇",
                "status": "1",
                parentName: '1',
                "url": "community/building",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 16,
                "name": "增加楼宇",
                "parentName": "楼宇管理",
                "desc": "增加楼宇",
                "status": "1",
                parentName: '15',
                "url": "community/building/create",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 17,
                "name": "删除楼宇",
                "parentName": "楼宇管理",
                "desc": "删除楼宇",
                "status": "1",
                parentName: '15',
                "url": "community/building/delete",
                updateTime: 1500192793000,
                remark: 'remark',
            },
            {
                id: 18,
                "name": "修改楼宇",
                "parentName": "楼宇管理",
                "desc": "修改楼宇信息",
                "status": "1",
                parentName: '15',
                "url": "community/building/modify",
                updateTime: 1500192793000,
                remark: 'remark',
            }
        ]
    })
})
router.post('/add', function (req, res, next) {
    res.json({
        message: 1,
        result: true,
        resultData: {
            id: 18,
            "name": "NNNNNNNNNNN",
            "parentName": "楼宇管理",
            "desc": "修改楼宇信息",
            "status": "1",
            parentName: '15',
            "url": "community/building/modify",
            remark: 'remark',
            updateTime: 1500192793000,
        }
    })
})

module.exports = router;
/**
 * Created by zhuo on 2017/8/1.
 */
